//
//  MSSegmentedButton.h
//  Community
//
//  Created by luo danal on 3/23/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum {
    kMSSegmentedTypeDefault = 0,
    kMSSegmentedTypeImage
} MSSegmentedType;


@interface MSSegmentedButtonItem : NSObject
@property (assign,nonatomic) NSInteger count;
@property (copy,nonatomic) NSString *title;
@property (retain,nonatomic) UIImage *image;
@property (retain,nonatomic) UIImage *imageHighlighted;

- (id)initWithTitle:(NSString *)title count:(NSInteger)count;

- (id)initWithImage:(UIImage *)image imageHighlighted:(UIImage *)image2;


@end

#pragma mark - 


@protocol MSSegmentedButtonDelegate;

@interface MSSegmentedButton : UIView {
    CGFloat _unitWidth;
    CGFloat _width;
}

@property (assign,nonatomic) id<MSSegmentedButtonDelegate> delegate;
@property (nonatomic) MSSegmentedType type;
@property (assign,nonatomic) NSInteger numberOfSegment;
@property (retain,nonatomic) NSArray *items;

//- (id)initWithFrame:(CGRect)frame type:(MSSegmentedType)type numberOfSegment:(NSInteger)count;

- (id)initWithFrame:(CGRect)frame titleItems:(NSArray *)items;

- (id)initWithFrame:(CGRect)frame imageItems:(NSArray *)items;

- (void)setCount:(NSInteger)count forItemAtIndex:(NSInteger)index;

- (void)setImage:(UIImage *)image forItemAtIndex:(NSInteger)index;

- (IBAction)buttonAction:(id)sender;

@end


@protocol MSSegmentedButtonDelegate <NSObject>

- (void)segmentedButton:(MSSegmentedButton *)seg clickedButtonAtIndex:(NSInteger)index;

@end